
ko_name = first_chr_dev
obj-m := $(ko_name).o

#KERNELDIR := /lib/modules/$(shell uname -r)/kernel
KERNELDIR := /home/orangepi/Desktop/3.4-sun8i
CURRENT_PATH := $(PWD)

all:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
install:all
	sudo install -D -m 644 $(ko_name).ko /lib/modules/$(shell uname -r)/kernel/extra/$(ko_name).ko
	sudo depmod -a
load:
	sudo insmod $(ko_name).ko
unload:
	sudo rmmod $(ko_name)
demesg:
	sudo dmesg
modinfo:
	sudo modinfo $(ko_name).ko
mknod:
	sudo mknod /dev/first_chr_dev c 200 0
rm_mknod:
	sudo rm -f /dev/first_chr_dev
clean:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean

